#pragma once
#include "WinDefines.h"
#include <string>
#include <optional>
#include "HSException.h"
#include "KeyBoard.h"
#include "Mouse.h"
#include "Graphics.h"
#include <memory>
#include "UIManager.h"
class Window
{
private:
	class WindowClass
	{
	public:
		static const char* GetName() noexcept;
		static HINSTANCE GetInstance() noexcept;
	private:
		WindowClass();
		~WindowClass();
		WindowClass(const WindowClass&) = delete;
		WindowClass& operator=(const WindowClass&) = delete;
		static constexpr const char* wndClassName = "Direct3D Engine Window";
		static WindowClass wndClass;
		HINSTANCE hInst;
	};
public:
	Window(int width, int height, const char* name);
	~Window();
	Window(const Window&) = delete;
	Window& operator=(const Window&) = delete;
	static std::optional<int> ProcessMessages() noexcept;
	void SetTitle(const std::string& title);
	const HWND& GetWindowHandle();
	LRESULT HandleMsg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
public:
	std::unique_ptr<DirectX::Keyboard> m_pKeyboard;
	std::unique_ptr<DirectX::Mouse> m_pMouse;
	DirectX::Keyboard::KeyboardStateTracker m_KeyboardStateTracker;
	DirectX::Mouse::ButtonStateTracker m_MouseStateTracker;

private:
	int width;
	int height;
	HWND hwnd;
};